package com.irdstudio.efp.cus.service.impl;

import com.irdstudio.basic.framework.core.base.FrameworkService;
import com.irdstudio.efp.cus.service.dao.AcctInfoDetailDao;
import com.irdstudio.efp.cus.service.domain.AcctInfoDetail;
import com.irdstudio.efp.cus.service.facade.AcctInfoDetailService;
import com.irdstudio.efp.cus.service.vo.AcctInfoDetailVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Service Impl: 公积金账户详细信息表服务实现
 *
 * @author gcb
 * @date 2020-08-11
 */
@Service("acctInfoDetailService")
public class AcctInfoDetailServiceImpl implements AcctInfoDetailService, FrameworkService {

    private static Logger logger = LoggerFactory.getLogger(AcctInfoDetailServiceImpl.class);

    @Autowired
    private AcctInfoDetailDao acctInfoDetailDao;

    /**
     * 新增数据
     *
     * @param acctInfoDetailVo
     * @return
     */
    @Override
    public int insert(AcctInfoDetailVO acctInfoDetailVo) throws Exception {
        AcctInfoDetail acctInfoDetail = new AcctInfoDetail();
        beanCopy(acctInfoDetailVo, acctInfoDetail);
        return acctInfoDetailDao.insert(acctInfoDetail);
    }

    /**
     * 根据主键删除信息
     *
     * @param acctInfoDetailVo
     * @return
     */
    @Override
    public int deleteByPk(AcctInfoDetailVO acctInfoDetailVo) throws Exception {
        AcctInfoDetail acctInfoDetail = new AcctInfoDetail();
        beanCopy(acctInfoDetailVo, acctInfoDetail);
        return acctInfoDetailDao.deleteByPk(acctInfoDetail);
    }

    /**
     * 根据主键更新信息
     *
     * @param acctInfoDetailVo
     * @return
     */
    @Override
    public int updateByPk(AcctInfoDetailVO acctInfoDetailVo) throws Exception {
        AcctInfoDetail acctInfoDetail = new AcctInfoDetail();
        beanCopy(acctInfoDetailVo, acctInfoDetail);
        return acctInfoDetailDao.updateByPk(acctInfoDetail);
    }

    /**
     * 根据主键查询详情
     *
     * @param inAcctInfoDetailVo
     * @return
     */
    @Override
    public AcctInfoDetailVO queryByPk(AcctInfoDetailVO inAcctInfoDetailVo) throws Exception {
        AcctInfoDetail queryAcctInfoDetail = new AcctInfoDetail();
        beanCopy(inAcctInfoDetailVo, queryAcctInfoDetail);
        AcctInfoDetail queryRslAcctInfoDetail = acctInfoDetailDao.queryByPk(queryAcctInfoDetail);
        return beanCopy(queryRslAcctInfoDetail, new AcctInfoDetailVO());
    }
}
